/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package persistence;

import core.AEntityContentProvider;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Set;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Ivan
 */
@Entity
@Table(name = "SYS_GROUP")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "SysGroup.findAll", query = "SELECT s FROM SysGroup s"),
    @NamedQuery(name = "SysGroup.findBySysGroupId", query = "SELECT s FROM SysGroup s WHERE s.sysGroupId = :sysGroupId"),
    @NamedQuery(name = "SysGroup.findByName", query = "SELECT s FROM SysGroup s WHERE s.name = :name")})
public class SysGroup extends AEntityContentProvider<SysGroup> implements Serializable {
    private static final long serialVersionUID = 1L;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Id
    //@Basic(optional = false)
    //@NotNull
    @GeneratedValue(generator="CommonSeq", strategy= GenerationType.SEQUENCE)
   // @SequenceGenerator( name="CommonSeq",sequenceName="common_seq", allocationSize=1)
    @Column(name = "SYS_GROUP_ID")
    private BigDecimal sysGroupId;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 20)
    @Column(name = "NAME")
    private String name;
    @OneToMany(mappedBy = "sysGroupId")
    private Set<SysUser> sysUserSet;

    public SysGroup() {
    }

    public SysGroup(BigDecimal sysGroupId) {
        super(SysGroup.class);
        this.sysGroupId = sysGroupId;
    }

    public SysGroup(BigDecimal sysGroupId, String name) {
        super(SysGroup.class);
        this.sysGroupId = sysGroupId;
        this.name = name;
    }

    public BigDecimal getSysGroupId() {
        return sysGroupId;
    }

    public void setSysGroupId(BigDecimal sysGroupId) {
        this.sysGroupId = sysGroupId;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @XmlTransient
    public Set<SysUser> getSysUserSet() {
        return sysUserSet;
    }

    public void setSysUserSet(Set<SysUser> sysUserSet) {
        this.sysUserSet = sysUserSet;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (sysGroupId != null ? sysGroupId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof SysGroup)) {
            return false;
        }
        SysGroup other = (SysGroup) object;
        if ((this.sysGroupId == null && other.sysGroupId != null) || (this.sysGroupId != null && !this.sysGroupId.equals(other.sysGroupId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "persistence.SysGroup[ sysGroupId=" + sysGroupId + " ]";
    }
    
}
